package com.airnewslinkosky.ticket.ui;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.RelativeLayout.LayoutParams;

import com.airnewslinkosky.ticket.R;
import com.mobclick.android.MobclickAgent;

/**
 * 支付结果面
 * @author 
 */
public class PayResult extends BaseActivity implements OnClickListener{
	private ImageView resultImg;
	private TextView resultText;
	
	public static boolean isPaySuccess = false;
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.pay_result);
		activityList.add(this);
		
		//初始化接钮
		findViewById(R.id.button_main).setOnClickListener(this);
		
		resultImg = (ImageView) findViewById(R.id.resultImg);
		resultText = (TextView) findViewById(R.id.resultText);
		if(!isPaySuccess){
			resultImg.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.error));
			LayoutParams para;
	        para = (LayoutParams) resultImg.getLayoutParams();
	        para.height = 128;
	        para.width = 128;
			resultText.setText("支付失败");
		} else {
			resultImg.setBackgroundDrawable(this.getResources().getDrawable(R.drawable.success));
			LayoutParams para;
	        para = (LayoutParams) resultImg.getLayoutParams();
	        para.height = 128;
	        para.width = 128;
	        resultImg.setLayoutParams(para);
			resultText.setText("支付成功");
		}
		
	}
	
	
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.button_main: 
				Intent intent = new Intent();
				intent.setClass(PayResult.this, Main.class);
				startActivity(intent);
				break;
		}
	}

	public void onResume() {     
		super.onResume();     
		MobclickAgent.onResume(this); 
	}  
	
	public void onPause() {     
		super.onPause();     
		MobclickAgent.onPause(this); 
	}  
	

}